{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Layered Plot with Dual-Axis\n",
    "---------------------------\n",
    "This example shows how to combine two plots and keep their axes.\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "\n",
    "import altair as alt\n",
    "alt.data_transformers.enable('json')\n",
    "from vega_datasets import data\n",
    "\n",
    "source = data.seattle_weather()\n",
    "\n",
    "base = alt.Chart(source).encode(\n",
    "    alt.X('date:O',\n",
    "        axis=alt.Axis(format='%b'),\n",
    "        timeUnit='month',\n",
    "        scale=alt.Scale(zero=False)\n",
    "    )\n",
    ")\n",
    "\n",
    "bar = base.mark_bar().encode(\n",
    "    y='mean(precipitation)'\n",
    ")\n",
    "\n",
    "\n",
    "line =  base.mark_line(color='red').encode(\n",
    "    y='mean(temp_max)',\n",
    ")\n",
    "\n",
    "alt.layer(\n",
    "    bar,\n",
    "    line\n",
    ").resolve_scale(\n",
    "    y='independent'\n",
    ")\n"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "env": {},
   "interrupt_mode": "signal",
   "language": "python",
   "metadata": {},
   "name": "python3"
  },
  "language": "python"
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
